<template>
  <div>网站首页</div>
</template>

<script>
export default {
  methods: {
    // 从cookie中获得用户信息
    getCookeieUserInfo() {
      const info = Cookies.get('userInfo')
      if (info !== undefined) {
        const infoObj = JSON.parse(info)
        Cookies.set('userInfo', info, { expires: 60 })
        return infoObj
      } else {
        return undefined
      }
    },
    // 修改cookie的信息
    setCookeieUserInfo(updateName, updateData) {
      const result = JSON.parse(Cookies.get('userInfo'))
      if (result !== undefined) {
        result[updateName] = updateData
      }
      Cookies.set('userInfo', JSON.stringify(result), { expires: 60 })
    },
  },
}
</script>

<style></style>
